package com.zee.example;

import android.graphics.drawable.AnimationDrawable;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.zee.recyclerview.HintText;
import com.zee.recyclerview.IRecyclerViewLoadMoreView;

public class DRLoadingMoreViewRecyclerView implements IRecyclerViewLoadMoreView {
    private AnimationDrawable animationDrawable;
    private TextView loadTextView;
    private ImageView loadImage;


    @Override
    public int getLayoutID() {
        return R.layout.layout_dr_load;
    }

    @Override
    public void initViews(LinearLayout linearLayout) {
        loadImage = linearLayout.findViewById(R.id.id_load_image);
        animationDrawable = (AnimationDrawable) loadImage.getBackground();
        loadTextView = linearLayout.findViewById(R.id.id_load_text);
        animationDrawable.start();
    }

    @Override
    public void onLoadStart() {
        loadTextView.setText("加载中");
    }

    @Override
    public void onLoadEnd() {
        loadTextView.setText("加载结束");
    }

    @Override
    public void onNoData() {
        loadTextView.setText("没有数据");
    }

    @Override
    public void destroy() {
        //清除动画
        loadImage.clearAnimation();
        animationDrawable.stop();
        animationDrawable = null;

    }

    @Override
    public void setHintText(HintText mHintText) {

    }
}
